<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<header th:fragment="nav">
    <div class="container" style="margin-top: 5px;">
        <nav class="navbar navbar-default well-sm" style="padding-left: 0px;" role="navigation">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example-navbar-collapse">
                        <span class="sr-only">切换导航</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#" th:href="@{/book/index}">泽晋书城</a>
                </div>
                <div class="collapse navbar-collapse" id="example-navbar-collapse">
                    <ul class="nav navbar-nav pull-left">
                        <li class="active">
                            <a href="index.html" th:href="@{/book/index}">首页</a>
                        </li>

                        <li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                图书类型
                                <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList(category=1)}">文艺</a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList(category=2)}">人物传记</a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList(category=3)}">风物</a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList1}">全部图书</a>
                                </li>
                            </ul>
                        </li>
                        </li>
                        <li th:if="(${session.user == null}) and (${session.adamin == null})">
                            <a href="#" data-toggle="modal" data-target="#loginModal">登录</a>
                        </li>
                        <li th:if="(${session.user == null}) and (${session.adamin== null})">
                        <a href="#" data-toggle="modal" data-target="#AdaminloginModal">管理员登录</a>
                        </li>
                        <li th:if="${session.adamin != null}">
                            <a href="javascript:void(0)" th:text="'欢迎管理员'+${session.adamin.adaminname}">安全退出</a>
                        </li>
                        <li th:if="${session.adamin != null}">
                            <a href="#" data-toggle="modal" data-target="#addModal">增加图书</a>
                            <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                                    &times;
                                            </button>
                                            <h4 class="modal-title" id="addModalLabel">
                                                添加图书
                                            </h4>
                                        </div>
                                        <div class="modal-body">
                                            <!--登录的form表单-->
                                            <form id="addForm" class="form-horizontal" enctype="multipart/form-data" method="post" th:action="@{/book/save}" action="/book/save" role="form">

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">封面</label>
                                                    <div class="col-sm-5">
                                                        <input type="file" name="img" >
                                                    </div>
                                                </div>

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">ISBN</label>
                                                    <div class="col-sm-5">
                                                        <input type="text"  id="isbn" name="isbn" class="form-control" placeholder="填入书本isbn">
                                                    </div>
                                                </div>


                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">书名</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" id="name" name="name" class="form-control" placeholder="填入书本名">
                                                    </div>
                                                </div>

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">作者</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" id="author" name="author" class="form-control" placeholder="填入作者">
                                                    </div>
                                                </div>

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">出版社</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" id="publisher" name="publisher" class="form-control"  placeholder="填入出版社">
                                                    </div>
                                                </div>

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">原价</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" id="newPrice" name="newPrice" class="form-control" placeholder="填入原价">
                                                    </div>
                                                </div>

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">现价</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" id="oldPrice" name="oldPrice" class="form-control"  placeholder="填入现价">
                                                    </div>
                                                </div>
<!--                                                <div class="form-group has-feedback">-->
<!--                                                    <label class="col-sm-2 control-label">是否套装</label>-->
<!--                                                    <div class="col-sm-5">-->
<!--                                                        <input type="radio" name="suit1" class="form-control" value=1>是-->
<!--                                                        <input type="radio" name="suit1" class="form-control" value=2>否-->

<!--                                                    </div>-->
<!--                                                </div>-->

<!--                                                <div class="form-group has-feedback">-->
<!--                                                    <label class="col-sm-2 control-label">类别</label>-->
<!--                                                    <div class="col-sm-5">-->
<!--                                                        <input type="radio" name="category1" class="form-control" value=1>文艺类-->
<!--                                                        <input type="radio" name="category1" class="form-control" value=2>人物传记类-->
<!--                                                        <input type="radio" name="category1" class="form-control" value=3>凤舞类-->
<!--                                                    </div>-->
<!--                                                </div>-->

<!--                                                <div class="form-group has-feedback">-->
<!--                                                    <label class="col-sm-2 control-label">出版日期</label>-->
<!--                                                    <div class="col-sm-5">-->
<!--                                                        <input type="date" id="date" name="date" class="form-control" >-->
<!--                                                    </div>-->
<!--                                                </div>-->

                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">作者地区</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" id="authorLoc" name="authorLoc" class="form-control" placeholder="填入国别">
                                                    </div>
                                                </div>
                                                <div class="form-group has-feedback">
                                                    <label class="col-sm-2 control-label">说明</label>
                                                    <div class="col-sm-5">
                                                        <input type="text" name="info" class="form-control" placeholder="说明">
                                                    </div>
                                                </div>

                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                    <input type="submit" class="btn btn-primary" value="提交" >
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li th:if="${session.adamin != null}">
                            <a href="index.html" th:href="@{/adamin/logout}">安全退出</a>
                        </li>
                        <li th:if="${session.user != null}">
                            <a href="#" data-toggle="modal" data-target="#touxiangModal" >
                                <div align="center">
                                <img class="img-circle" th:src="@{'/public/' + ${session.user.getPhoto()}}" style="width: 20px;height: 20px" alt="点击此处插入头像"/>
                                </div>
                            </a>
                            <div class="modal fade" id="touxiangModal" tabindex="-1" role="dialog" aria-labelledby="touxiangModalLabel" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                                &times;
                                            </button>
                                            <h4 class="modal-title" id="touxiangModalLabel">
                                                头像上传
                                            </h4>

                                        </div>
                                        <div class="modal-body">
                                            <form  class="form-horizontal" enctype="multipart/form-data" method="post" th:action="@{/user/save}" action="/user/save" role="form">
                                                <div class="form-group has-feedback">
                                                    <div class="col-sm-5">
                                                        <input type="file" name="img" >
                                                    </div>
                                                </div>
                                                <div class="form-group has-feedback">
                                                    <div class="col-sm-5">
                                                        <input type="hidden" name="id" th:value="${session.user.getId()}"/>
                                                    </div>
                                                </div>
                                                <div class="form-group has-feedback">
                                                    <div class="col-sm-5">
                                                        <input type="hidden" name="username" th:value="${session.user.getUsername()}"/>
                                                    </div>
                                                </div>
                                                <input type="submit" value="上传"/>
                                            </form>
                                            <!--form结束-->
                                        </div>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                            </div>
                        </li>
                        <li th:if="${session.user != null}">
                            <a href="javascript:void(0)" th:text="'欢迎用户' + ${session.user.username}">安全退出</a>
                        </li>
                        <li th:if="${session.user != null}">
                            <a href="index.html" th:href="@{/user/logout}">安全退出</a>
                        </li>
                        <li th:if="(${session.user == null}) and (${session.adamin == null})">
                            <a href="#" data-toggle="modal" data-target="#register">注册</a>
                        </li>
                        <li th:if="${session.adamin == null}">
                            <a href="order_list.html" th:href="@{/order/list}">我的订单</a>
                        </li>
                        <li th:if="${session.adamin == null}">
                            <a href="cart.html" th:href="@{/cart/list}"><span class="glyphicon glyphicon-shopping-cart"> </span>我的购物车</a>
                        </li>
                    </ul>
                    <div class="input-group col-md-3 pull-right" style="positon:relative;padding: 7px;">
                            <input type="text" class="form-control" id="bookname" placeholder="请输入图书名" />
                            <span class="input-group-btn">
					            <button class="btn btn-info btn-search" th:onclick="selectBook()">
					            	<span class="glyphicon glyphicon-search"></span>
					            </button>
							</span>

                    </div>
                </div>
            </div>
        </nav>
    </div>

</header>
